#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'xdao07'

import base64
import gitlab


url = 'http://192.168.10.112'
token = 'q8sY2x6TF8eKWYy8RAB7'


# 登录
gl = gitlab.Gitlab(url, token)

# 获取项目
project = gl.projects.get('ZEP-BACKEND/ZEP-BACKEND-JAVA')
# 获取javademo/config目录下文件列表，版本为master
items = project.repository_tree(path='javademo/config', ref='master')
for item in items:
    # 获取id并进行内容输出
    file_info = project.repository_blob(item['id'])
    content = base64.b64decode(file_info['content'])
    print(content.decode())
    print("===({})===".format(item['path']))
